document.onreadystatechange = function()
{    
    if(document.readyState=="complete")
    {
        var searchTags = System.Gadget.Settings.read("charactername");
        if(searchTags != "")
        {
            document.getElementById('charactername').value = searchTags;
        }      
    }        
}

System.Gadget.onSettingsClosing = function(event)
{
    if (event.closeAction == event.Action.commit)
    {
        var searchTags = document.getElementById('charactername').value;
        if(searchTags != "")
        {
            System.Gadget.Settings.writeString("charactername", searchTags);
        }
        event.cancel = false;
    }
}